package com.wufun.overseas.main.base;

import android.content.Context;
import android.os.Bundle;

import com.google.gson.Gson;
import com.wufun.baselibrary.base.BaseFragment;
import com.wufun.baselibrary.download.CommonDownloadFactory;
import com.wufun.overseas.models.event.DownloadResultEvent;

/**
 * Created by tangbingliang on 17/2/16.
 */

public abstract class MyFragment extends BaseFragment {


    protected CommonDownloadFactory factory;
    protected Context mContext;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        factory = CommonDownloadFactory.get();
    }

    @Override
    public void onResume() {
        super.onResume();
    }

    public void fragmentEvent(DownloadResultEvent eventData) {
    }

    public void showToast(String msg) {
        getBaseAppCompatActivity().showToast(msg);
    }

    public int getmWidth() {
        return ((MyActivity) getActivity()).getmWidth();
    }

    public int getmHeight() {
        return ((MyActivity) getActivity()).getmHight();
    }

    public void StartGame(String url, String GamePath) {
        ((MyActivity) getActivity()).StartGame(url, GamePath);
    }

    public void addDownloadToDB(String gameName, String url, String gameId, String img, String gameSize, String typeStr) {
        ((MyActivity) getActivity()).addDownloadToDB(gameName, url, gameId, img, gameSize, typeStr);
    }
}
